<template>
  <div class="auth">授权登录中...</div>
</template>
<script setup>
import getUserInfoHook from "@/hooks/getUserInfo";
import zhuYunHook from "@/hooks/zhuYun";
import { onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
const router = useRouter();
const route = useRoute();
const { getUserInfoFun } = getUserInfoHook();
const { zhuYunFun } = zhuYunHook();
onMounted(async () => {
  if (route.query.state) {
    localStorage.setItem("state", route.query.state);
  }
  // WPS认证
  // const data = await getUserInfoFun();
  // WPS、zhuYun认证
  const data = await zhuYunFun();
  if (data) {
    router.replace({ name: "chat", query: { state: route.query.state } });
  }
});
</script>
<style>
.auth {
  margin: 20px;
}
</style>
